﻿using ConsoleApp2.Madel.Entity;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp2.Madel
{
    public class Dbinit : DropCreateDatabaseIfModelChanges<Admin3000DbContext>
    {
        protected override void Seed(Admin3000DbContext context)
        {

            var class1 = new Class
            {
                ClassName = "计应一班"
            };

            var class2 = new Class
            {
                ClassName = "计应二班"
            };

            context.Classes.Add(class1);
            context.Classes.Add(class2);

            context.SaveChanges();


            var student = new Student
            {
                StudentName = "老蒋",
                ClassId = class2.Id
                
            };

            context.Students.Add(student);
            context.SaveChanges();

            base.Seed(context);
        }

    }
}
